package day8;

import day6.pet.Dog;
import day6.pet.Penguiun;
import day6.pet.Pet;
import day7.Crocodile;

import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class FlowerAndBirdMarket {
    private String name;
    public FlowerAndBirdMarket(String name){
        this.name=name;
    }
    //花钱买宠物
    public Pet buy(int money){
        if(money>=100000){
            return new Crocodile("大赖皮",70,70,"公");
        }
        if(money>10000){
            return new Penguiun("小蓝企鹅",90,90,"公");
        }
        if(money>=500){
            return new Dog("二黄",80,80,"公","田园犬");
        }
        return null;//null可以转换成任意类型
    }

    public static void main(String[] args) {
        FlowerAndBirdMarket m=new FlowerAndBirdMarket("裕丰花鸟鱼虫市场");
        Scanner in=new Scanner(System.in);
        System.out.print("准备花多少钱买宠物：");
        int money=in.nextInt();
        Pet pet = m.buy(money);
        if(pet==null){
            System.out.println("钱少了，没买到");
        }else{
            System.out.println("买到了");
            pet.print();
        }
    }
}
